﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WS.EKA.Business.Model;
using Newtonsoft.Json;

namespace WS.EKA.UI.Business
{
    /// <summary>
    /// 今日工单解决率
    /// </summary>
    internal class TodayIncident : ReportBase<TodayIncidentResolvedPercentForUI>
    {
        public override WebSocketClientType Key
        {
            get
            {
                return WebSocketClientType.Incident_TodayResolvedPercent;
            }
        }

        public override string GetJsonString(object parameter)
        {
            var obj = (parameter as ReportParameter<TodayIncidentResolvedPercentForUI>).Data;
            obj.ResolvedPercent = (int)((obj.NewResolved / (float)obj.NewAdd) * 100);
            return JsonConvert.SerializeObject(obj);
        }
    }
}
